package cn.edu.zjut.medlinebackend.common;

public class ResultUtils {
    public static <T> BaseResponse<T> success(T data) {
        return new BaseResponse<>(0, data, "ok");
    }

    public static <T> BaseResponse<T> error(int code, String msg){
        return new BaseResponse<T>(code, null, msg);
    }

    public static <T> BaseResponse<T> error(int code, String msg, String description){
        return new BaseResponse<T>(code, null, msg, description);
    }

    public static <T> BaseResponse<T> error(ErrorCode errorCode){
        return new BaseResponse<T>(errorCode);
    }
}
